<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>奔跑的熊大</title>
    <style>
        section {
            position: relative;
            width: 1910px;
            height: 920px;
            overflow: hidden;
        }

        div[class^="hill"] {
            position: absolute;
            left: 0;
            width: 3840px;
            /* 设置背景图像的大小 */
            background-size: 50%;
            animation: hill 16s linear 8s infinite;
        }

        .hill_1 {
            top: 200px;
            height: 285px;
            background-image: url(hill_1.png);
        }

        .hill_2 {
            top: 300px;
            height: 168px;
            background-image: url(hill_2.png);
        }

        .bear {
            position: absolute;
            top: 360px;
            left: 0;
            width: 200px;
            height: 100px;
            background: url(bear.png) no-repeat;
            animation: bear .8s steps(8) infinite, move 8s linear forwards;
        }

        @keyframes bear {
            from {
                background-position: 0 0;
            }

            to {
                background-position: -1600px 0;
            }
        }

        @keyframes move {
            from {
                left: -200px;
            }

            to {
                left: 50%;
                transform: translateX(-50%);
            }
        }

        @keyframes hill {
            from {
                left: 0;
            }

            to {
                left: -1920px;
            }
        }
    </style>
</head>

<body>
    <section>
        <div class="hill_1"></div>
        <div class="hill_2"></div>
        <div class="bear"></div>
    </section>
</body>

</html>